package cn.tedu.luban.account.main.repository;

import cn.tedu.luban.account.main.converter.AccountConverter;
import cn.tedu.luban.account.main.dao.AccountDAO;
import cn.tedu.luban.account.protocol.bo.AccountBO;
import cn.tedu.luban.account.protocol.dos.AccountDO;
import cn.tedu.luban.account.protocol.param.AccountCreateParam;
import cn.tedu.luban.account.protocol.param.AccountParam;
import cn.tedu.luban.account.protocol.param.AccountPayParam;
import cn.tedu.luban.account.protocol.query.AccountQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class AccountRepoImpl implements AccountRepository{
    @Autowired
    private AccountDAO accountDAO;
    @Autowired
    private AccountConverter accountConverter;
    @Override
    public AccountBO getAccountByUserId(Long userId) {
        //select * from account where user_id=#{userId}
        AccountDO accountDO = accountDAO.selectAccountByUserId(userId);
        return accountConverter.do2bo(accountDO);
    }
    @Override
    public Long save(AccountCreateParam accountParam) {
        AccountDO accountDO = accountConverter.param2do(accountParam);
        return accountDAO.insert(accountDO);
    }

    @Override
    public AccountBO getAccount(Long accountId) {
        return null;
    }

    @Override
    public Long getAccountCount(AccountQuery accountQuery) {
        return null;
    }

    @Override
    public List<AccountBO> queryAccounts(AccountQuery accountBOQuery) {
        return null;
    }

    @Override
    public Integer disable(Long id) {
        return null;
    }

    @Override
    public Integer enable(Long id) {
        return null;
    }

    @Override
    public Long updateSettlingAmount(AccountPayParam param) {
        return null;
    }

    @Override
    public Long updateTotalAmount(AccountPayParam param) {
        return null;
    }

    @Override
    public void settleAccount(AccountParam param) {

    }


}
